<?php

namespace app\admin\validate;

use \think\Validate;

/**
 *  菜单参数验证
 */
class Menu extends Validate
{
    protected $rule = [
        'creator' => 'require',
        'parent_id' => 'require|integer',
        'type' => 'require|integer',
        'name' => 'require'
    ];

    //定义验证提示
    protected $message = [
        'creator.require' => '操作人不能为空',
        'parent_id.require' => '父级ID不能为空',
        'parent_id.integer' => '父级ID参数类型错误',
        'type.require' => '菜单类型不能为空',
        'type.integer' => '菜单类型参数错误',
        'name.require' => '菜单名称不能为空',
    ];

    //定义验证场景
    protected $scene = [
        'create' => ['creator','parent_id','type','name']
    ];

}
